
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
	<title>信息登记</title>
	<link rel="stylesheet" type="text/css" th:href="@{/css/mui.min.css}"/>
	<link rel="stylesheet" type="text/css" th:href="@{/css/saoma.css}"/>

	<script th:src="@{/js/jquery.min.js}"></script>
	<script th:src="@{/js/mui.min.js}"></script>

</head>
<body>
<div class="index_box_null">
	<div class="mes_ban">
		<img th:src="@{/img/banner.png}"/>
	</div>
	<div class="mes_tishi">
		<div class="mes_tg">
			<img th:src="@{/img/gonggao.png}"/>
			<p class="notic_p1 inlinb">小区公告：疫情防控，请如实填写信息</p>
		</div>
	</div>
</div>
	<div class="mes_center">
		<p class="notic_p2 mes_list_bot1">
			<span class="null-line"></span>
			个人信息登记<span>【[[${comName}]]】</span>
		</p>
		<input id="comId" type="hidden" th:value="${comId}">
		<input id="comName" type="hidden" th:value="${comName}">
		<input id="openId" type="hidden" th:value="${openId}">
        <div class="mes_list_con">
            <div class="mes_list mes_list_bot2">
                <div class="mes_txt">姓名<span class="sp_red">*</span></div>
                <div class="mes_inp">
                    <input type="text" id="name" name="name" value=""  placeholder="请输入姓名"/>
                </div>
            </div>
            <div class="mes_list mes_list_bot1">
                <div class="mes_txt">身份证号<span class="sp_red">*</span></div>
                <div class="mes_inp">
                    <input type="text" id="pinCode" name="pinCode" value=""  placeholder="请输入身份证号"/>
                </div>
            </div>
            <div class="mes_list mes_list_bot2">
                <div class="mes_txt">手机号<span class="sp_red">*</span></div>
                <div class="mes_inp">
                    <input type="text" id="phone" name="phone" value=""  placeholder="请输入手机号" maxlength="11"/>
                </div>
            </div>

            <div class="mes_list mes_list_bot2" style="padding-bottom: 10px;">
                <div class="mes_txt">人员类型<span class="sp_red">*</span></div>
                <div class="mes_sel">
                    <select name="type" id="type" >
                        <option value="">请选择</option>
                        <option value="1">业主</option>
                        <option value="2">家属</option>
                        <option value="3">租客</option>
                        <option value="4">其他</option>
                    </select>
                </div>
            </div>

            <div class="mes_list mes_list_bot1">
                <div class="mes_txt">楼栋<span class="sp_red">*</span></div>
                <div class="mes_inp">
                    <input type="text" id="buildCode" name="buildCode" value=""  placeholder="请输入楼栋"/>
                </div>
            </div>
            <div class="mes_list mes_list_bot2">
                <div class="mes_txt">单元<span class="sp_red">*</span></div>
                <div class="mes_inp">
                    <input type="text" id="unit" name="unit" value=""  placeholder="请输入单元"/>
                </div>
            </div>
            <div class="mes_list mes_list_bot2">
                <div class="mes_txt">房间号<span class="sp_red">*</span></div>
                <div class="mes_inp">
                    <input type="text" id="roomNo" name="roomNo" value=""  placeholder="请输入房间号"/>
                </div>
            </div>
            <div class="mes_list lin_bot mes_list_bot2">
                <div class="mes_txt02 inlinb">是否到过疫情严重地区<span class="sp_red">*</span></div>
                <div class="swit_inp"><input type="checkbox" class="swich" name="ncpAreaPass" onclick="ncpAreaPasss()"><span id="ncpAreaPasss">否</span></div>
            </div>
            <div class="lin_bot mes_list_bot1" id="ncpAreaPassSelect" style="display: none">
                <div class="mes_txt02 inlinb">选择地区(可多选)</div>
                <div class="mes_chomore">
                    <div class="choose_box">
                        <span>湖北</span>
                        <input type="checkbox" name="passNcpArea" value="湖北" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>浙江</span>
                        <input type="checkbox" name="passNcpArea" value="浙江" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>信阳</span>
                        <input type="checkbox" name="passNcpArea" value="信阳" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>南阳</span>
                        <input type="checkbox" name="passNcpArea" value="南阳" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>周口</span>
                        <input type="checkbox" name="passNcpArea" value="周口" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>商丘</span>
                        <input type="checkbox" name="passNcpArea" value="商丘" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>驻马店</span>
                        <input type="checkbox" name="passNcpArea" value="驻马店" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>其他地区</span>
                        <input type="text" name="otherArea" id="otherArea" value=""class="choose_moreip" placeholder="请输入地区"/>
                    </div>
                </div>
            </div>

            <div class="mes_list lin_bot mes_list_bot2">
                <div class="mes_txt02 inlinb">是否接触过疑似病人<span class="sp_red">*</span></div>
                <div class="swit_inp"><input type="checkbox" name="contactNcpPatient" onclick="contactNcpPatients()" class="swich" ><span id="contactNcpPatients">否</span></div>
            </div>

            <div class="mes_list lin_bot mes_list_bot1">
                <div class="mes_txt02 inlinb">是否有不适<span class="sp_red">*</span></div>
                <div class="swit_inp"><input type="checkbox" name="illness" onclick="illnesss()" class="swich"><span id="illnesss">否</span></div>
            </div>
            <div class="lin_bot mes_list_bot2" id="illnessSelect" style="display: none">
                <div class="mes_txt02 inlinb">身体状况(可多选)</div>
                <div class="mes_chomore">
                    <div class="choose_box">
                        <span>发热</span>
                        <input type="checkbox" name="symptom" value="发热" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>胸闷</span>
                        <input type="checkbox" name="symptom" value="胸闷" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>咳嗽</span>
                        <input type="checkbox" name="symptom" value="咳嗽" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>乏力</span>
                        <input type="checkbox" name="symptom" value="乏力" class="choose_more tui-checkbox"/>
                    </div>
                    <div class="choose_box">
                        <span>其他症状</span>
                        <input type="text" name="otherSymptom" id="otherSymptom" value=""class="choose_moreip" placeholder="请输入症状"/>
                    </div>
                </div>
            </div>
            <div class="mes_list lin_bot mes_list_bot2">
                <div class="choose_box">
                    <span>其他</span>
                    <input type="text" name="remark" id="remark" value=""class="choose_moreip inlinb" placeholder="请输入信息"/>
                </div>
            </div>
        </div>

	</div>
	<div class="mes_btn"> <input type="button" name="" id="" onclick="subBtu()" value="提交" /></div>
</body>
<script type="text/javascript">

    var ua = navigator.userAgent.toLowerCase();
    var isWeixin = ua.indexOf('micromessenger') != -1;


    $(function () {
            var btnArray = ['否', '是'];
            mui.confirm('请谨慎填写,防疫期间只允许有一个居住地址,如有瞒报可能造成不便,甚至可能将承担相关法律责任', '请问您是否是本小区住户?', btnArray, function(e) {
                if (e.index != 1) {
                    window.location.href="../record/noHousehold";
                }
            });
    });

	var illness = "0";
    function illnesss(){
        $("#illnesss").html("");
        if(illness == "0"){
            illness = "1";
            $("#illnesss").html("是");
            $("#illnessSelect").show();
		}else{
            illness = "0";
            $("#illnesss").html("否");
            $("#illnessSelect").hide();
        }
	}

    var contactNcpPatient="0";
    function contactNcpPatients(){
        $("#contactNcpPatients").html("")
        if(contactNcpPatient == "0"){
            contactNcpPatient = "1";
            $("#contactNcpPatients").html("是")
        }else{
            contactNcpPatient = "0";
            $("#contactNcpPatients").html("否")
        }
    }
    var ncpAreaPass="0";
    function ncpAreaPasss(){
        $("#ncpAreaPasss").html("")
        if(ncpAreaPass == "0"){
            ncpAreaPass = "1";
            $("#ncpAreaPasss").html("是")
            $("#ncpAreaPassSelect").show();
        }else{
            ncpAreaPass = "0";
            $("#ncpAreaPasss").html("否")
            $("#ncpAreaPassSelect").hide();
        }
    }

    function subBtu(){
        var name=$("#name").val();
        var pinCode= $("#pinCode").val();
        var phone=$("#phone").val();
        var buildCode=$("#buildCode").val();
        var unit=$("#unit").val();
        var roomNo=$("#roomNo").val();
        var passNcpArea = [];
        $("input[name='passNcpArea']:checked").each(function () {
            if($(this).is(':checked')==true){
                passNcpArea.push($(this).val());
            }
        })
        passNcpArea = passNcpArea.toString();
        var otherArea = $("#otherArea").val();
        var symptom = [];
        $("input[name='symptom']:checked").each(function () {
            if($(this).is(':checked')==true){
                symptom.push($(this).val());
            }
        });
        symptom = symptom.toString();
        var otherSymptom = $("#otherSymptom").val();
        var remark = $("#remark").val();
        var type = $("#type").val();
        if(!/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(pinCode)){
            mui.alert("身份证不正确");
            return false;
        }

        if(otherSymptom !="" && otherSymptom!=null){
            if(symptom !="" && symptom !=null){
                symptom = symptom+","+otherSymptom;
            }else{
                symptom=otherSymptom;
            }

        }
        if(otherArea !="" && otherArea !=null){
            if(passNcpArea !="" && passNcpArea !=null){
                passNcpArea = passNcpArea +","+otherArea;
            }else{
                passNcpArea =otherArea;
            }
        }

        if(type == "" || type == null){
            mui.alert("请选择人员类型");
            return false;
        }

        var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
        if (!myreg.test(phone)) {
            mui.alert("手机号不正确");
            return false;
        }

        if(name =="" || name ==null){
			mui.alert("请输入姓名");
			return false;
        }
        if(pinCode =="" || pinCode ==null){
            mui.alert("请输入身份证");
            return false;
        }
        if(phone =="" || phone ==null){
            mui.alert("请输入手机号");
            return false;
        }
        if(buildCode =="" || buildCode ==null){
            mui.alert("请输入楼栋");
            return false;
        }
        if(unit =="" || unit ==null){
            mui.alert("请输入单元");
            return false;
        }
        if(roomNo ==null || roomNo ==""){
            mui.alert("请输入房间编号");
            return false;
        }
        $.ajax({
            url:"../record/saveData",
            type: "post",
            dataType: "json",
            data: {
                name:name,
                pinCode:pinCode,
                phone:phone,
                buildCode:buildCode,
                unit:unit,
                roomNo:roomNo,
                ncpAreaPass:ncpAreaPass,
                passNcpArea:passNcpArea,
                contactNcpPatient:contactNcpPatient,
                illness:illness,
                symptom:symptom,
                otherArea:otherArea,
                otherSymptom:otherSymptom,
                remark:remark,
				comId:$("#comId").val(),
                comName:$("#comName").val(),
                type:type,
                openId:$("#openId").val()

			},
            success: function(data) {
               window.location.href="../record/details?id="+data.msg;
            }
		})
    }

</script>
</html>
